import useUserStore from "@/store/modules/user.js";


export default {
    mounted(el, binding) {
        const {value} = binding
        const permissionList = useUserStore().permissionList
        const permissions = permissionList.map(item => item.action)
        if(value && value instanceof Array && value.length > 0){
            //判断两个数组是否有相同项
            const hasPermissions = value.some(permission => {
                return permissions.includes(permission)
            })
            if (!hasPermissions) {
                el.parentNode && el.parentNode.removeChild(el)
            }
        }
    }
}

